package com.hk.biz;

import java.sql.SQLException;
import java.util.List;
import android.content.Context;
import android.util.Log;

import com.hk.db.DBHelper;
import com.hk.model.Question;
import com.j256.ormlite.stmt.QueryBuilder;

public class BLL {
	
	//查询不同类型的题目数量
	
	//查询不同类型题目已做数量
	
	
	//根据题目类型查询所有试题
	public static List<Question> getQuestionListByType(Context context,String type){
		DBHelper helper = DBHelper.getHelper(context);
		try {		
			List<Question> list= helper.getQuestionDao().queryBuilder().where().eq("QuestionType", type).query();
			return list;
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}
	
	//根据父ID获取试题列表
	public static List<Question> getQuestionListByPid(Context context,String pid){
		DBHelper helper = DBHelper.getHelper(context);
		try {		
			List<Question> list= helper.getQuestionDao().queryBuilder().where().eq("ParentID", pid).query();
			return list;
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}
	
}
